import { ResourceType} from 'authing-js-sdk'
import {getUser} from "@/utils/auth";
import {getManagementClient} from "@/utils/authing-util";

// 获取用户授权的菜单 code
export async function getMenuCodes() {
  const user = getUser()
  let codes = []
  await getManagementClient().users.listAuthorizedResources(
    JSON.parse(user).id,
    '626bfa7676640382aee27c74',
    {resourceType: ResourceType.Menu}).then(res => {
    codes = res.list.map(l => l.code)
  })

  return codes
}
